package kandl.automation.testsuite;

import java.util.Arrays;

public class TestStep {

    private final String testCaseId;
    private final String keyword;
    private final String[] parameters;
    private String id;

    public TestStep(String id, String testCaseId, String keyword, String... parameters) {
        this.id = id;
        this.testCaseId = testCaseId;
        this.keyword = keyword;
        this.parameters = Arrays.copyOf(parameters, parameters.length);
    }

    public String getKeyword() {
        return keyword;
    }
    
    public String getParameter(int index) {
        return parameters[index];
    }

    public String getId() {
        return id;
    }

    public String getTestCaseId() {
        return testCaseId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TestStep testStep = (TestStep) o;
        return id.equals(testStep.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return id;
    }

    public String[] getParameters() {
        return Arrays.copyOf(parameters, parameters.length);
    }
}
